package cn.edu.hit.selflearning;

import cn.edu.hit.core.Document;
import cn.edu.hit.core.db.*;

import java.util.List;

public class FindFeaturePort {

    static DataConnection connection = DataConnectionLoader.getInstance();
    static DataReader reader = connection.getReader();
    static DBReadHelper dbHelper = new DBReadHelper(reader);

    public List<Document> FindFeaturePortList() {

        List<Document> featureList = reader.queryByTemplate(Filters.eq("type", "feature"));

        featureList.stream().forEach(feature -> {
            String featureName = feature.getString("signalType");
            String chanenelStr = feature.getString("CombineChanenels");
            String[] chanenelIdArray = chanenelStr.substring(1, chanenelStr.length() - 1).split(",");


            for (int k = 0; k < chanenelIdArray.length; k++) {
                String portId = chanenelIdArray[k];
                if (portId.length() > 5) {
                    Document signalDocunment = dbHelper.getById(portId.substring(1, portId.length() - 1));


                }
            }
        });
        return null;
    }
}
